Crate coarsetime
source ·Expand description
A crate to make time measurements that focuses on speed.
This crate is a partial replacement for the Time
and Duration
structures
from the standard library, with the following differences:
- Speed is privileged over accuracy. In particular,
CLOCK_MONOTONIC_COARSE
is used to retrieve the clock value on Linux systems, and transformations avoid operations that can be slow on non-Intel systems. - The number of system calls can be kept to a minimum. The “most recent timestamp” is always kept in memory. It can be read with just a load operation, and can be updated only as frequently as necessary.
§Installation
coarsetime
is available on crates.io and works on
Rust stable, beta, and nightly.
Windows and Unix-like systems are supported.
Structs§
- System time
- A duration type to represent an approximate span of time
- A measurement of a monotonically increasing clock. Opaque and useful only with
Duration
. Resulting durations are actual durations; they do not get affected by clock adjustments, leap seconds, or similar. In order to get a measurement of the wall clock, useDate
instead. - A service to periodically call
Instant::update()
Type Aliases§
- Alias for
Duration
.